﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace MDIDemo.Modules
{
    public partial class DoiMatKhau : DevExpress.XtraEditors.XtraForm
    {
        string sErr = "";
        public DoiMatKhau()
        {
            InitializeComponent();
        }

        private void btnDong_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btnLuu_Click(object sender, EventArgs e)
        {
            BUS.PODControl ctr = new BUS.PODControl();
            DTO.PODInfo inf = ctr.Get(frmMain.__userID, ref sErr);
            if (inf.PASS != NguoiDung.HashString(txtOld.Text))
                lbErr.Text = "Mật khẩu cũ không đúng";
            else if (txtNew.Text != txtConfirm.Text)
                lbErr.Text = "Mật khẩu xác nhận không đúng";
            else
            {
                inf.PASS = NguoiDung.HashString(txtNew.Text);
                ctr.InsertUpdate(inf);
                Close();
            }
        }
    }
}